let app = document.getElementById('app')


window.onkeydown = function(e){
  app.innerHTML = ''
  let key_obj = {
    key:e.key,
    code:e.code,
    keyCode:e.keyCode,
  }

  for (const key in key_obj) {
    app.appendChild(createdItem(`event.${key}`,key_obj[key]))
  }
  
    if(e.key == 'F5'){
      console.log("jinli");
      e.keyCode = 0
      // 将此属性设置为ture 也可以阻止事件冒泡
      e.cancelBubble = true
      return false
    }
}


// 鼠标右键事件
document.oncontextmenu = function () {
  return false;
}


function createdItem(name,content){
  let key_item = document.createElement('div')
  key_item.classList.add('key_item')
  let name_box = document.createElement('div')
  name_box.classList.add('key_name')
  name_box.innerText = name
  let content_box = document.createElement('div')
  content_box.classList.add('key_content')
  content_box.innerText = content
  key_item.appendChild(name_box)
  key_item.appendChild(content_box)
  return key_item
}